var t = require("../../utils/systemInfo"), e = t.systemInfo.windowWidth, i = t.systemInfo.pixelRatio;

Component({
    options: {
        addGlobalClass: !0
    },
    properties: {
        src: {
            type: String,
            value: "",
            observer: function(t) {
                this.updateUrl(t);
            }
        },
        className: {
            type: String,
            value: ""
        },
        mode: {
            type: String,
            value: "scaleToFill"
        },
        dataStyle: {
            type: String,
            value: ""
        },
        maxWidth: {
            type: Number,
            value: e * i
        },
        maxHeight: {
            type: Number,
            value: null
        }
    },
    data: {
        imageUrl: null
    },
    lifetimes: {
        ready: function() {}
    },
    pageLifetimes: {
        show: function() {},
        hide: function() {}
    },
    methods: {
        updateUrl: function(t) {
            if (t) if (-1 !== t.indexOf("aijiatui.com")) {
                var e = this.data, i = e.maxWidth, a = e.maxHeight, l = t.split("?")[0];
                l += "?imageMogr2/auto-orient", l += "/thumbnail/" + i + "x", a && (l += "" + a), 
                this.setData({
                    imageUrl: l
                });
            } else this.setData({
                imageUrl: t
            });
        },
        handleLoad: function(t) {
            this.triggerEvent("load", t.detail);
        },
        handleError: function(t) {
            this.triggerEvent("error", t.detail);
        }
    }
});